<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
namespace app\admin\controller;


/**
 * 我们的客户管理控制器
 */
class Customer extends AdminBase
{
    /**
     * 我们的客户列表
     * @return type
     */
    public function CustomerList()
    {    
        
        $this->assign('list', $this->logicCustomer->getCustomerList());
        
        return $this->fetch('customer_list');
    }
    
    /**
     * 我们的客户添加
     * @return type
     */
    public function customerAdd()
    {
        $this->CustomerCommon();
        
        $this->assign('info', []);
        
        return $this->fetch('customer_edit');
    }
    
    /**
     * 保存我们的客户
     */
    public function CustomerEdit()
    {         
        $this->CustomerCommon();
        
        $info = $this->logicCustomer->getCustomerInfo(['a.id' => $this->param['id']]);
 
        $this->assign('info', $info);
        
        return $this->fetch('customer_edit');
    }
    
    /**
     * 更改业绩状态
     */
    public function setStatus()
    {
        
       $this->jump($this->logicAdminBase->setStatus('Customer', $this->param));
    }


    /**
     * 我们的客户添加与编辑通用方法
     */
    public function CustomerCommon()
    {
        
        IS_POST && $this->jump($this->logicCustomer->CustomerEdit($this->param));//判断是否表单提交 是则跳转保存处理
    }
}
